/*            Copyright(c) 2006-2008 Dave Sexton           *
 * http://www.codeplex.com/DocProject                      *
 * http://www.codeplex.com/DocProject/Project/License.aspx *
 ***********************************************************/
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.XPath;

namespace DaveSexton.DocProject.Sandcastle.TopicManagement
{
	public sealed class MemberConfigNode : ApiFilterConfigNode
	{
		#region Public Properties
		public TypeConfigNode DeclaringType
		{
			get
			{
				return type;
			}
		}
		#endregion

		#region Private / Protected
		private readonly TypeConfigNode type;
		#endregion

		#region Constructors
		/// <summary>
		/// Constructs a new instance of the <see cref="MemberConfigNode" /> class.
		/// </summary>
		private MemberConfigNode(TypeConfigNode type, string name, bool expose)
			: base("member", type, TopicType.Member, name, expose)
		{
			if (type == null)
				throw new ArgumentNullException("type");

			this.type = type;
		}

		/// <summary>
		/// Constructs a new instance of the <see cref="MemberConfigNode" /> class for the specified <paramref name="node" />.
		/// </summary>
		internal MemberConfigNode(TypeConfigNode type, XPathNavigator node)
			: base(node, TopicType.Member)
		{
			if (type == null)
				throw new ArgumentNullException("type");

			this.type = type;
		}
		#endregion

		#region Methods
		public static MemberConfigNode AppendTo(TypeConfigNode type, string name, bool expose)
		{
			MemberConfigNode node = new MemberConfigNode(type, name, expose);

			type.AddMember(node);

			return node;
		}
		#endregion
	}
}
